Device Template File Properties

The IoT Sparkplug EIE sample device template file includes unique data group elements and attributes and may include a section specific to this EIE. This topic contains an example of an IoT Sparkplug device template file.

Device Template Elements and Attributes for the IoT Sparkplug EIE

Sparkplug defines a standard mechanism for formatting payload data, so very little customization is provided for in the device template file. The only customization allowed provides a mapping from payload text strings representing data units to CygNet units.

Payload Definition

The payloadDef section of an IoT Sparkplug EIE device template file contains information to allow users to interpret payload data for CygNet. This section is optional.

Element Description

mapUnits

Maps units in the payload to CygNet units. This section is needed only when the payload indicates data units that you want to import into CygNet.

For example, CygNet represents kilograms as "kg", while a payload may use the text "KGRAM". This section of the device template file can be used to map the text string "KGRAM" from the payload to "kg" in CygNet.

ex

Each enumeration must begin with a lowercase e. It is then to be followed by a "units" text string as defined in the payload (e.g., units "KGRAM" in the payload is represented as eKGRAM.)

Each enumeration element must be unique, but its value does not need to be unique. For example, using eKGRAM twice within a single enumeration list is illegal, but using the value "kg" for eKGRAM and eKILOGRAM is legal.

Each enumeration must use a value attribute to define a constant value that corresponds to a valid CygNet unit. See PNT Engineering Units.

Device Definition Attributes

The following table lists and describes IoT Sparkplug-specific device definition attributes.

Attribute Description

class

Set to "POC" if the payload represents a pump-off controller and includes dynagraph cards. Otherwise the attribute should be omitted.

Data Group Attributes

The following table lists and describes IoT Sparkplug-specific data group attributes.

Attribute Description

setUnreliableOnLostConnection

If setUnreliableOnLostConnection is set to "true", all CygNet points will be set to unreliable upon receipt of a DEATH message for the topic associated with the data group. Otherwise the point status is unchanged.

A DEATH message is issued when the MQTT server loses the connection to the remote device or node.

uccRecv

Set to "true" to allow a rebirth request to be issued via UIS command.

canRecv

Set to "true" to allow a rebirth request to be issued from CygNet Explorer.

Data Group Elements

The following table lists and describes IoT Sparkplug-specific data group elements. These items are identified in the Sparkplug specification, but are optional and may not appear in all payload files.

Data Group Element ID Description

_topicSeq

The topic/payload sequence number.

_topicUuid

The topic/payload UUID.

_topicTime

The topic/payload data time. This value is used for point processing in the absence of a timestamp associated with each payload item.

Data Group Element Attributes

The following table lists and describes IoT Sparkplug-specific attributes of data group elements.

Attribute Description

itemId

The required name of the item in the payload file. This is used to map an item in a payload file to a CygNet data group element. It is not used for data group elements _topicSeq, _topicUuid, or _topicTime, which are predefined in the Sparkplug specification.

The itemId allows the following substitution strings :

  • %deviceId%
  • %facilityId%
  • %ordinal%

type

It is recommended that type variant ("vrnt") be used to preserve the data type provided in the payload.

IoTSparkplug_Sample.dtf

The IoTSparkplug_Sample device template file includes data that defines what the Sparkplug payload looks like and where to find specific items in the payload. For more information about the Sparkplug specification, refer to the Sparkplug Specification document.

The following example displays the IoTSparkplug_Sample.dtf.

Example

IoTSparkplug_POC.dtf

The IoTSparkplug_POC sample device template file includes the "Dynagraph Card" (DynaCard) data group. This device represents a pump-off controller, so the device class is identified as "POC" and the device template file includes a "Dynagraph Card" (DynaCard) data group. The "Dynagraph Card" data group includes data group elements only to support point processing. If point processing is not desired, they can be omitted.

The following example displays a section of the IoTSparkplug_POC.dtf. Note the attribute class="POC" in the deviceDefinition section.

For more information, see IoT Sparkplug EIE Dynagraph Card Data Group.

Example

Sending Cards to ForeSite

For ForeSite to successfully collect cards from the IoT device, the IoTSparkplug_POC.dtf must include the CardCnt dgElement. While CardCnt is not necessary to collect cards in CygNet, ForeSite requires the element when pulling cards into its Card Library, and the IoT device template file is often used for ForeSite Edge. Card collection from the IoT device when CardCnt is not included in the device template file will fail.

Example

Back to top